package com.jones.restaurant.framework;

import android.app.Application;

import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;

public class MyApplication extends Application {
	@Override
	public void onCreate() {
		super.onCreate();
	DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
	.cacheInMemory(true)  //1.8.6包使用时候，括号里面传入参数true
	.cacheOnDisc(true)    //同上
	
	    .build();
	 ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
	  .defaultDisplayImageOptions(defaultOptions)
	    .threadPriority(Thread.NORM_PRIORITY - 2)
	    .denyCacheImageMultipleSizesInMemory()
	    .discCacheFileNameGenerator(new Md5FileNameGenerator())
	    .tasksProcessingOrder(QueueProcessingType.LIFO)
	    .build();
	
	   ImageLoader.getInstance().init(config);
	}
}
